home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / PCSHFT.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  477b  |  21 lines

  1. PROCEDURE pcshft(a,b: real; VAR d: glcarray; n: integer);
  2. (* Programs using routine PCSHFT must define the type
  3. glcarray as in routine CHEBFT. *)
  4. VAR
  5.    k,j: integer;
  6.    fac,cnst: real;
  7. BEGIN
  8.    cnst := 2.0/(b-a);
  9.    fac := cnst;
  10.    FOR j := 2 TO n DO BEGIN
  11.       d[j] := d[j]*fac;
  12.       fac := fac*cnst
  13.    END;
  14.    cnst := 0.5*(a+b);
  15.    FOR j := 1 TO n-1 DO BEGIN
  16.       FOR k := n-1 DOWNTO j DO BEGIN
  17.          d[k] := d[k]-cnst*d[k+1]
  18.       END
  19.    END
  20. END;
  21.